import request from '@/utils/request'

/**
 * 获取商品详情
 * @param {String} id - 商品ID
 */
export const findGoods = id => {
  return request({
    method:'get',
    url: '/goods',
    params: {
      id
    }
  })
}

export const findRelGoods = (id,limit=16) => {
  return request({
    method: 'get',
    url: '/goods/relevant',
    params: {
      id,
      limit
    }
  })
} 

export const findHotGoods = (id,type, limit = 3) => {
  return request({
    method: 'get',
    url: '/goods/hot',
    params: {
      id,
      limit,
      type
    }
  })
}

// 获取商品评价信息
export const findCommentInfoByGoods = (id) => {
  return request({
    method: 'get',
    url: `/goods/${id}/evaluate`
  })
}

// 获取商品评价分页信息列表
export const findCommentListByGoods = (id) => {
  return request({
    method: 'get',
    url: `/goods/${id}/evaluate/page`
  })
}
